package com.example.demo.service.Impl;

import com.example.demo.entity.User;
import com.example.demo.mapper.UserMapper;
import com.example.demo.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class LoginServiceImpl implements LoginService {

    @Autowired
    UserMapper userMapper;

    @Override
    public String getPasswordByUsername(User user) {

        User user1= userMapper.getPasswordByUsername(user.getUsername());
        if(user1.getPassword().equals(user.getPassword())){
            if(user1.getIsadmin()==0)
                return "user";
        }

        else
            return "admin";

        return null;
    }
}
